package com.maiji.cloud.microservice;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.maiji.cloud.request.BaseDataReqDto;
import com.maiji.cloud.response.BaseDataResDto;
import com.maiji.cloud.response.login.ActivityShareRuleConfigResData;
import com.maiji.cloud.service.ActivityShareRuleConfigService;

@RestController
@RequestMapping("/shareRuleConfig/")
public class ActivityShareRuleConfigController {
	@Autowired
    private ActivityShareRuleConfigService activityShareRuleConfigService;

	/**
	 * 根据类型获取活动分享规则信息
	 * @param param
	 * @return
	 */
	@PostMapping("getActivityShareRuleConfigByType")
	public BaseDataResDto<ActivityShareRuleConfigResData> getActivityShareRuleConfigByType(
			@RequestBody BaseDataReqDto<Integer> param) {
		Integer type = param.getData();
		return activityShareRuleConfigService.getActivityShareRuleConfigByType(type);
	}

	/**
	 * 根据类型获取活动分享规则信息
	 * @param type
	 * @return
	 */
	@PostMapping("getAsrcByType")
	public ActivityShareRuleConfigResData getAsrcByType(@RequestBody Integer type) {
		return activityShareRuleConfigService.getActivityShareRuleConfigByType(type).getData();
	}

}
